/*自定义body.js*/

$(function () {

    $("#qqSanGuo").on("mousedown",function (event) {
        //移动前的位置
        var qqSanGuo_startX = event.clientX-$(this)[0].offsetLeft;
        var qqSanGuo_startY = event.clientY-$(this)[0].offsetTop;
        $("#qqSanGuo").bind("mousemove",function (event) {
            var qqSanGuo_afterX = event.clientX-qqSanGuo_startX+"px";
            var qqSanGuo_afterY = event.clientY-qqSanGuo_startY+"px";
            if (event.clientX-qqSanGuo_startX<=0){
                $(this).css({left:qqSanGuo_afterX = 0+"px"});
            }
            if (event.clientY-qqSanGuo_startY<=0){
                $(this).css({top:qqSanGuo_afterY = 0+"px"});
            }
            if(event.clientX-qqSanGuo_startX>=500){
                $(this).css({left:qqSanGuo_afterY = 500+"px"});
            }
            if (event.clientY-qqSanGuo_startY>=400){
                $(this).css({top:qqSanGuo_afterY = 400+"px"});
            }
            $(this).css({
               left:qqSanGuo_afterX,
               top:qqSanGuo_afterY
            });
        })
    })
    $("#qqSanGuo").bind("mouseup",function () {
        $(this).unbind("mousemove");
    })

    $("#qqSanGuo").on("dblclick",function(){
        var myHtml="";
        myHtml=myHtml+"<div class='sanGuoExe'>";
        myHtml=myHtml+"QQ三国";
        myHtml=myHtml+"</div>";
        $("#exeDisplayExe").html(myHtml);
        setTimeout(function(){
            $("#exePageContentLeft").css("display","block");
        },2000);

        $(".sanGuoExe").on("click",function () {
            if($("#exePageContentLeft").css("display")=="block"){
                return;
            }else {
                $(".sanGuoExe").css("background","rgba(220,220,220,0.5)");
                $("#exePageContentLeft").css("display","block");
            }
        })
    })


    /*-----------------------------narrowExe--------------------------------*/

    $("#narrowExe").on("mouseover",function () {
        $(this).css("opacity","1");
    })
    $("#narrowExe").on("mouseout",function () {
        $(this).css("opacity","0.5");
    })
    $("#narrowExe").on("click",function () {
        $("#exePageContentLeft").css("display","none");
        $(".sanGuoExe").css("background","rgba(220,220,220,1)");
    })

    /*--------------------------------------closeExe------------------------------*/
    $("#closeExe").on("mouseover",function () {
        $(this).css("opacity","0.8");
    })
    $("#closeExe").on("mouseout",function () {
        $(this).css("opacity","0.5");
    })
    $("#closeExe").on("click",function () {
        $("#exePageContentLeft").css("display","none");
        $(".sanGuoExe").remove();
    })
})



